<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style></style>
  </head>
  <body>
    <div id="app">
      <button @click="setA">给obj的a属性赋值</button>
      {{obj.a}}
    </div>
    <script src="./vue.global.js"></script>
    <script>
      const { createApp } = Vue;
      const app = createApp({
        data() {
          return {
            obj: {},
          };
        },
        methods: {
          setA() {
            this.obj.a = "这是a属性";
            console.log(this.obj);
          },
        },
      });
      app.mount("#app");
    </script>
  </body>
</html>
